package com.sumainfor.pc.gmio.controller.housekeeper;

import com.sumainfor.common.util.JsonResult;
import com.sumainfor.common.utlis.PageUtils;
import com.sumainfor.common.utlis.Pager;
import com.sumainfor.pc.gmio.service.HoForcedReasonService;
import com.sumainfor.pc.gmio.service.HoForcedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 *强制退原因
 */
@RestController
@RequestMapping("/housekeeper/HoForced")
public class HoForcedController implements Serializable {
    @Autowired
    private HoForcedService hoForcedService;

    /**
     * 发起强制退房申请
     */
    @PostMapping("/addHoForce")
    public JsonResult addHoForce(@RequestBody Map<String,Object>params){

        return hoForcedService.addHoForce(params);
    }
    /**
     * 查询强制退列表
     */
    @PostMapping("/getHoLivecardList")
    public JsonResult getHoLivecardList(@RequestBody Map<String,Object>params){
        JsonResult result=new JsonResult();
        Pager pager=new Pager();
        pager.setPageno(Integer.parseInt(params.get("pageno").toString()));
        pager.setPagesize(Integer.parseInt(params.get("pagesize").toString()));
        pager.setPagerNecessary(params, pager);
        PageUtils pageUtils = new PageUtils();
        Integer cout=hoForcedService.getHoForcedListCount(params);
        if(cout==0){
            return pageUtils.getJsonResult(new ArrayList<Map<String,Object>>(), params,cout);
        }
        List<Map<String,Object>> getCommunityList=hoForcedService.getHoForcedList(params);
        result=pageUtils.getJsonResult(getCommunityList, params, cout);
        return result;
    }
}
